﻿
-- ================================================
-- Remarks: Not part of standard Stored Proc
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'Ivy_UserOrganizationRole_GetAllByPersonKey')
	BEGIN
		DROP  Procedure  Ivy_UserOrganizationRole_GetAllByPersonKey
	END

GO

CREATE PROCEDURE [Ivy_UserOrganizationRole_GetAllByPersonKey] 
-- =============================================
-- Author:		<Ram pravesh kr>
-- Create date: <29/05/2016>
-- Description:	<Ivy_UserOrganizationRole_GetAllByPersonKey>
-- =============================================
-- Add the parameters for the stored procedure here
	(
				@UserPersonKey int
	)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT OFF;

	SELECT	[UserKey],		
			[UserOrganizationKey],
			[UserRoleKey],
			[UserLoginID],
			[UserOrganizationCode], 
			[UserOrganizationName],
			[UserRoleCode],
			[UserRoleName],

			[Sys_DateOfCreation],
			[Sys_DateOfModification],
			[Sys_CreatedByID],
			[Sys_ModifiedByID],
			[Sys_DeleteType],
			[Sys_IsDeleted],
			[Sys_OrganizationID],
			[Sys_InitialPrimaryKeys],
			[Sys_WorkstationName]
	FROM	[UserOrganizationRole]
	WHERE		
		(
			([UserKey] = @UserPersonKey) AND (UserRoleCode <> 'SYSREGUSR')
		);
END
GO
